import visitorlist from '../src/data/visitorlist.json'
import servicelist from '../src/data/servicelist.json'
import servicelog from '../src/data/servicelog.json'
import chatlog from '../src/data/chatlog.json'
import houselist from '../src/data/house/fang_house.json'
import housesand from '../src/data/house/fang_house_sand.json'
import second_house from '../src/data/hire/fang_second_house.json'
import rental_house from '../src/data/hire/fang_rental.json'



export default {
    "GET /getvisitorlist":visitorlist,
    "GET /getservicelist":servicelist,
    // 服务记录
    "GET /getservicelog":(req:any,res:any)=>{
        const {search}=req.query
        if(search){
            const arr=servicelog.data.filter((item:any)=>{
                return item.kefu_name.includes(search)
            })
            res.send(arr)
        }else{
            res.send(servicelog.data)
        }

    },
    // 聊天记录
    "GET /getchatlog":(req:any,res:any)=>{
        const {search}=req.query
        if(search){
            const arr=chatlog.data.filter((item:any)=>{
                return item.from_name.includes(search)
            })
            res.send(arr)
        }else{
            res.send(chatlog.data)
        }

    },
    // 请求楼盘列表
    "GET /gethouselist":(req:any,res:any)=>{
        const {search}=req.query
        if(search){
            const arr=houselist.data.filter((item:any)=>{
                return item.from_name.includes(search)
            })
            res.send(arr)
        }else{
            res.send(houselist)
        }
    },
    // 请求楼盘列表
    "GET /getsandlist":housesand,
    "GET /getsecoundlist":second_house,
    "GET /gethirelist":rental_house,
}